Skip to content

test(agent): regression coverage for #2169 skill load tool on fresh sessions#2369

Open
gxgeek-n wants to merge 1 commit into
agentscope-ai:mainfrom
gxgeek-n:test/2169-skill-load-fresh-session
Open

test(agent): regression coverage for #2169 skill load tool on fresh sessions#2369
gxgeek-n wants to merge 1 commit into
agentscope-ai:mainfrom
gxgeek-n:test/2169-skill-load-fresh-session

Conversation

@gxgeek-n

Copy link
Copy Markdown

Summary

Adds end-to-end regression tests pinning the fix for #2169 (Unauthorized tool call: 'load_skill_through_path' is not available on fresh sessions).

The bug: on the first call of a fresh session, activateSlotForContext applied the state's (empty) activated group list via setActiveGroups, deactivating the build-time active skill-build-in-tools group. SkillHook kept advertising skills in the system prompt, so the model inevitably called load_skill_through_path and got the Unauthorized error. This was fixed on main by #2319 (fresh slots inherit build-time active groups), but the end-to-end path through a real SkillBox + ReActAgent call had no coverage — existing tests only assert state seeding with manually-created groups, and SkillBoxTest/SkillBoxToolsTest never drive a full agent call.

What the tests do

SkillLoadToolFreshSessionTest drives a scripted model through a real ReAct loop with a registered skill, asserting on the tool result exactly as the model observes it:

  1. freshSession_skillLoadToolExecutes — the load tool executes and returns the skill content (not Unauthorized)
  2. freshSession_stateSeedsSkillGroupToolContextState keeps skill-build-in-tools activated after the call
  3. secondCall_skillLoadToolStillAuthorized — activation survives repeated calls in one session (the wipe happened per call, not just on the first)

Verified both directions

# v2.0.0
Tests run: 3, Failures: 3 — Unauthorized tool call: 'load_skill_through_path' is not available
# main
Tests run: 3, Failures: 0, Errors: 0 — BUILD SUCCESS

Notes

Copilot AI review requested due to automatic review settings July 23, 2026 12:13
@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end regression coverage for #2169 by exercising a full ReAct loop with a real SkillBox + ReActAgent, asserting that load_skill_through_path remains authorized on fresh sessions and across repeated calls.

Changes:

  • Introduces SkillLoadToolFreshSessionTest with scripted-model e2e tests to ensure the skill load tool executes (not Unauthorized) on the first call of a fresh session.
  • Verifies ToolContextState retains the build-time active skill-build-in-tools group after the call.
  • Verifies authorization persists across a second call within the same session.

Comment on lines +91 to +96
// Registered skill ids carry a "_custom" source suffix (see RegisteredSkill);
// the load tool's skillId enum only accepts the registered form.
String registeredSkillId = SKILL_ID + "_custom";
Map<String, Object> input = new HashMap<>();
input.put("skillId", registeredSkillId);
input.put("path", "SKILL.md");
…ol on fresh sessions

Add end-to-end tests pinning the fix for agentscope-java#2169: a fresh-session
ReActAgent built with a SkillBox must be able to execute
load_skill_through_path instead of receiving
"Unauthorized tool call: 'load_skill_through_path' is not available".

The tests drive a scripted model through a real ReAct loop with a registered
skill and assert on the tool result exactly as the model observes it:

- fresh session: the load tool executes and returns the skill content
- fresh session: ToolContextState keeps skill-build-in-tools activated
- second call in the same session: the load tool stays authorized

Verified both directions: all three tests fail on the v2.0.0 tag with the
exact "Unauthorized tool call" error from the issue, and pass on main with
the fresh-slot group seeding from agentscope-ai#2319.
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gxgeek-n
gxgeek-n force-pushed the test/2169-skill-load-fresh-session branch from 3ceaf28 to 0227ef5 Compare July 23, 2026 12:27
@oss-maintainer

Copy link
Copy Markdown
Collaborator

CLA Not Signed

The Contributor License Agreement (CLA) check is currently pending on this PR (license/cla: Contributor License Agreement is not signed yet.). This PR cannot be merged until the CLA is signed.

@gxgeek-n please sign the CLA via the CLA assistant badge in the comment above, or visit https://cla-assistant.io/agentscope-ai/agentscope-java. Once signed, the license/cla status will turn green.


Automated check by github-manager-bot

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looks good.


Automated review by "github-manager-bot"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants